package com.example.gymmanagebackend.service.impl;

import com.example.gymmanagebackend.mapper.CoachReservationMapper;
import com.example.gymmanagebackend.pojo.CoachReservation;
import com.example.gymmanagebackend.service.CoachReservationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CoachReservationServiceImpl implements CoachReservationService {

    @Autowired
    private CoachReservationMapper coachReservationMapper;

    @Override
    public int addCoachReservation(CoachReservation reservation) {
        return coachReservationMapper.addCoachReservation(reservation);
    }

    @Override
    public List<CoachReservation> getCoachReservationsByUsername(String username) {
        return coachReservationMapper.getCoachReservationsByUsername(username);
    }
     @Override
    public int deleteCoachReservationByCondition(String coachName, String reservationTime) {
        return coachReservationMapper.deleteCoachReservationByCondition(coachName, reservationTime);
    }
    @Override
    public boolean isCoachReservationExists(String username, String coachName, String reservationTime, Date reservationDate) {
        int count = coachReservationMapper.checkCoachReservationExists(username, coachName, reservationTime, reservationDate);
        return count > 0;
    }
    @Override
    public List<CoachReservation> getAllCoachReservations() {
        return coachReservationMapper.getAllCoachReservations();
    }
    @Override
    public List<CoachReservation> getCoachReservationCount() {
        return coachReservationMapper.getCoachReservationCount();
    }

    @Override
    public List<CoachReservation> getCoachGenderDistribution() {
        return coachReservationMapper.getCoachGenderDistribution();
    }
}